﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Vici.Mvc;
using SSOtest.ServiceCenter;
namespace web
{
    public class Admin_default : AdminController
    {
        SSOtest.ServiceCenter.ServiceCenterSoapClient sc = new ServiceCenterSoapClient();
        [View("Admin/Default")]
        [Url("Admin/default")]
        public void Run()
        {
            ViewData["PageTitle"] = "SSOtest";
            this.ChangeLayout("Master/EasyUIMaster");
            Response.Write("<script>alert('当前登录用户:" + CurrentUser.LoginID + "');</script>");
        }

        [Url("Admin/LoginOut")]
        public void LoginOut()
        {
            Session["User"] = null;
            if (sc.LoginOut(Session["toKen"].ToString()))
                Redirect("~/admin/default");
            Redirect("~/admin/default");

        }

        [Url("Admin/SkipTo2012hao")]
        public void Skip()
        {

            if (string.IsNullOrEmpty(sc.CheckToken(Session["toKen"].ToString(), HttpContext.Current.Request.UserHostAddress)))
            {
                Session["toKen"] = sc.AddNewToken(CurrentUser.LoginID, CurrentUser.PassWord, HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.Host);
            }
            Redirect("http://2012hao.com/admin/default?toKen=" + Session["toKen"].ToString());
        }
        [Url("Admin/SkipToBake")]
        public void SkipToBake()
        {

            if (string.IsNullOrEmpty(sc.CheckToken(Session["toKen"].ToString(), HttpContext.Current.Request.UserHostAddress)))
            {
                Session["toKen"] = sc.AddNewToken(CurrentUser.LoginID, CurrentUser.PassWord, HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.Host);
            }
            Redirect("http://local.bake.com/infologin.aspx?toKen=" + Session["toKen"].ToString());
        }
    }
}